#pragma once

#ifdef _WIN32
#include "WinSock2.h"
#pragma comment (lib, "ws2_32.lib")
#endif

class Socket {
public:
	Socket();
#ifdef _WIN32
	SOCKET _socket;
#endif

	int available();
	int listen(unsigned int port);
	Socket* accept();
	void close();
	
	int send(char c);
	int send(unsigned char* src, int size);
	int receive(unsigned char* dest, int size);

	char* ip;

	~Socket() {
		try {
		close();
		} catch (int) {
		}
	}
};